<?php

namespace Topxia\Service\Kuke\Dao\Impl;

use Topxia\Service\Common\BaseDao;
use Topxia\Service\Kuke\Dao\QuestionTypeDao;

class QuestionTypeDaoImpl extends BaseDao implements QuestionTypeDao
{
    protected $table = 'question_type';

    public function getQuestionType($type = '')
    {
        $sql = "SELECT * FROM {$this->table}";
		if ($type == ""){}else{
			$sql.=" where ptype = '$type'";
		}
		$res = $this->getConnection()->fetchAll($sql) ? : null;
		$arr = array();
		foreach ($res as $v){
			$arr[$v['name']] = $v;
		}
		return $arr;
    }
}